/*
 * 微信公众平台(JAVA) SDK
 *
 * Copyright (c) 2014, Ansitech Network Technology Co.,Ltd All rights reserved.
 *
 * http://www.weixin4j.org/
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.cl.unipay4j.ali;

import com.cl.unipay4j.core.Configuration;
import lombok.extern.slf4j.Slf4j;

/**
 * 支付宝支付配置文件
 *
 *
 * @author siashan
 * @since v1.0.1
 */
@Slf4j
public class AliConfiguration {

    private static Configuration configuration = Configuration.getInstance();

    /**
     * 获取开发者第三方用户唯一凭证
     *
     * @return 第三方用户唯一凭证
     */
    public static String getAppid() {
        return configuration.getProperty("cl.unipay4j.ali.config.appid");
    }

    /**
     * 获取签名加密算法
     *
     * @return 签名加密算法
     */
    public static String getSignType() {
        String signType = configuration.getProperty("cl.unipay4j.ali.config.signType");
        return signType == null ? "RSA2" : signType;
    }

    /**
     * 获取商户私钥
     *
     * @return 商户私钥
     */
    public static String getMerchantPrivateKey() {
        return configuration.getProperty("cl.unipay4j.ali.config.merchantPrivateKey");
    }

    /**
     * 获取支付宝公钥
     *
     * @return 支付宝公钥
     */
    public static String getAlipayPublicKey() {
        return configuration.getProperty("cl.unipay4j.ali.config.alipayPublicKey");
    }

    /**
     * 获取 报文格式
     *
     * @return 报文格式
     */
    public static String getFormat() {

        String format = configuration.getProperty("cl.unipay4j.ali.config.format");
        return format == null ? "json" : format;
    }

    /**
     * 获取 报文编码
     *
     * @return 报文编码
     */
    public static String getCharset() {
        String charset = configuration.getProperty("cl.unipay4j.ali.config.charset");
        return charset == null ? "utf-8" : charset;
    }

    /**
     * 获取 网关地址
     *
     * @return 网关地址
     */
    public static String getGatewayUrl() {
        String gateway = configuration.getProperty("cl.unipay4j.ali.config.gatewayUrl");
        return gateway == null ? "https://openapi.alipay.com/gateway.do" : gateway;
    }

    /**
     * 获取 回调地址
     *
     * @return 回调地址
     */
    public static String getNotifyUrl() {
        return configuration.getProperty("cl.unipay4j.ali.config.notifyUrl");
    }

}
